package com.mall.shopping.converter;


import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dto.GoodsSortDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @author TL
 * @created Date:2020/12/20 Time:15:58
 **/
@Mapper(componentModel = "spring")
public interface GoodsSortByPageConverter {
    @Mappings(
            {
                    @Mapping(source = "id",target = "productId"),
                    @Mapping(source = "price",target = "salePrice"),
                    @Mapping(source = "title",target = "productName"),
                    @Mapping(source = "sellPoint",target = "subTitle"),
                    @Mapping(source = "image",target = "picUrl")
            }
    )
    GoodsSortDto item2Dto(Item item);

    List<GoodsSortDto> items2DTO(List<Item> items);
}
